package pe.com.hermes.hermetic.negocio.ultil;

public class Querys {
    public Querys() {
    }

    public String queryInsertarTransaccionPedido() {
        String SQL = 
            "insert into ac_tran_pedi_clie (num_tran, nse_item, cod_sucu_htb, cod_clie," + 
            " fec_gene_tran, hor_gene_tran, nom_arch, cod_usua_tran, txt_tran) values (" + 
            " ?, ?, ?, ?, trunc(sysdate), sysdate, ?, ?, ?)";CadenaUtil.logSQL(this.getClass(),new Exception().getStackTrace()[0].getMethodName(),SQL);
        return SQL;
    }

    public String queryActualizaControlNumero() {
        String SQL = 
            "update tg_ctrl_nume set" + " num_docu_ulti = ? " + " where tip_docu = 'PE' and cod_seri = ? ";CadenaUtil.logSQL(this.getClass(),new Exception().getStackTrace()[0].getMethodName(),SQL);
        return SQL;
    }

    public String queryIngresaControlNumero() {
        String SQL = 
            "insert into tg_ctrl_nume (tip_docu,cod_seri,num_docu_ulti) values (" + 
            " 'PE',?,?)";CadenaUtil.logSQL(this.getClass(),new Exception().getStackTrace()[0].getMethodName(),SQL);
        return SQL;
    }

    public String queryInsertarPedido() {
        String SQL = 
            "insert into ac_pedido" + "(tip_docu_pedi,cod_seri_pedi,num_pedi,tip_pedi,cod_clie_orig," + 
            " cod_cnta_orig,cod_punt,des_dire_entg,ind_prio," + 
            " fec_pedi,fec_aten_pedi,fec_proc_aper,ind_prog," + 
            " txt_obsv,cod_usua_gene,cod_sucu_htb,fec_soli_pedi," + 
            " hor_soli_pedi,cod_clie_fact," + 
            " hor_aten_inic_pact,hor_aten_finl_pact," + 
            " cod_diar_pedi,ind_pedi_banc,cod_trnp, cod_cnta_dest,cod_clie_dest)" + 
            " values ('PE', ?, ?, ?, ?, ?, ?, ?, 0, sysdate," + 
            " ?, ?, ?, ?, ?, ?, trunc(sysdate), sysdate, ?," + 
            " to_date(?,'hh24:mi'), null, ?, 1, 1, ?, ?)";CadenaUtil.logSQL(this.getClass(),new Exception().getStackTrace()[0].getMethodName(),SQL);
        return SQL;
    }

    public String queryInsertarPedido2() {
        String SQL = 
            "insert into ac_pedido" + "(tip_docu_pedi,cod_seri_pedi,num_pedi,tip_pedi,cod_clie_orig," + 
            " cod_cnta_orig,cod_punt,des_dire_entg,ind_prio," + 
            " fec_pedi,fec_aten_pedi,fec_proc_aper,ind_prog," + 
            " txt_obsv,cod_usua_gene,cod_sucu_htb," + " cod_clie_fact," + 
            " hor_aten_inic_pact,hor_aten_finl_pact," + 
            " cod_diar_pedi,ind_pedi_banc,cod_trnp, cod_cnta_dest," + 
            " cod_clie_dest,fec_soli_pedi,hor_soli_pedi)" + 
            " values ('PE', ?, ?, ?, ?, ?, ?, ?, 0, sysdate," + 
            " ?, ?, ?, ?, ?, ?, ?," + 
            " to_date(?,'hh24:mi'), null, ?, 1, 1, ?, ?, to_date(?,'dd/mm/yyyy'), to_date(?,'hh24:mi') )";CadenaUtil.logSQL(this.getClass(),new Exception().getStackTrace()[0].getMethodName(),SQL);
        return SQL;
    }

    public String queryInsertarDetallePedido() {
        String SQL = 
            "insert into ac_pedido_deta (tip_docu_pedi, cod_seri_pedi, num_pedi," + 
            " nse_item_pedi,cod_bove, tip_bill,mon_pedi, est_item_pedi,ind_simu) values" + 
            "('PE', ?, ?, ?, ?, ?, ?,'1',0)";CadenaUtil.logSQL(this.getClass(),new Exception().getStackTrace()[0].getMethodName(),SQL);
        return SQL;
    }

    public String queryInsertarDenominacionPedido() {
        String SQL = 
            "insert into ac_pedido_deno (tip_docu_pedi,cod_seri_pedi,num_pedi," + 
            "nse_item_pedi,tip_mone,cod_deno,mon_deno) values ('PE', ?, ?," + 
            " ?, ?, ?, ?)";CadenaUtil.logSQL(this.getClass(),new Exception().getStackTrace()[0].getMethodName(),SQL);
        return SQL;
    }

    public String queryInsertarLineaTexto() {
        String SQL = 
            "insert into he_tran_clie (num_tran, nse_item, cod_sucu_htb," + 
            " cod_clie, fec_gene_tran, hor_gene_tran, nom_arch," + 
            " cod_usua_tran, txt_tran) values" + 
            " (?, ?, ?, ?, trunc(sysdate), sysdate, ?, ?, ?)";CadenaUtil.logSQL(this.getClass(),new Exception().getStackTrace()[0].getMethodName(),SQL);
        return SQL;
    }

    public String queryInsertarLineaTextoAbonos() {
        String SQL = 
            "insert into he_arch_abon (num_tran, nse_item, cod_sucu_htb," + 
            " cod_clie, fec_crea, nom_arch, cod_usua, des_line) values" + 
            " (?, ?, ?, ?, sysdate, ?, ?, ?)";CadenaUtil.logSQL(this.getClass(),new Exception().getStackTrace()[0].getMethodName(),SQL);
        return SQL;
    }

    public String queryEliminaLineasAbonos() {
        String SQL = 
            "delete he_arch_abon where cod_clie = ? and cod_sucu_htb = ? ";CadenaUtil.logSQL(this.getClass(),new Exception().getStackTrace()[0].getMethodName(),SQL);
        return SQL;
    }

    public String queryActualizaCuentasCliente() {
        String SQL = 
            "update ac_cntas_clie" + " set   ind_gen_arch     = ?," + "       cod_usu_gen_arch = ?," + 
            "       fec_gen_arch     = to_date(?,'ddmmyyyyhh24miss')," + 
            "       ind_imp_carg     = ?," + 
            "       fec_imp_carg     = to_date(?,'ddmmyyyyhh24miss')" + 
            " where tip_docu_cmpb = ?" + " and   cod_seri_cmpb = ?" + 
            " and   num_cmpb      = ?" + " and   num_carg_ingr = ?";
        CadenaUtil.logSQL(this.getClass(),new Exception().getStackTrace()[0].getMethodName(),SQL);
        return SQL;
    }

    /* No usar - JCR
    public String queryActualizaCuentasClienteImpresion() {
        String SQL = 
            "update ac_cntas_clie" + " set   fec_imp_carg     = to_date( ? ,'ddmmyyyyhh24miss')," + 
            "       cod_usua_impr    = ? " + " where num_carg_ingr    = ?";
        CadenaUtil.logSQL(this.getClass(),new Exception().getStackTrace()[0].getMethodName(),SQL);
        return SQL;
    }*/

    public String queryInsertaLogBtms() {
        String SQL = 
            "INSERT INTO bt_log_btms (fec_hora, cod_usua, des_acci," + " num_cmpb, cod_seri_cmpb, tip_docu_cmpb,mon_acci, ind_impr)" + 
            " VALUES" + " (sysdate, ?, ?, ?, ?, ?, ?, ?)";
        CadenaUtil.logSQL(this.getClass(),new Exception().getStackTrace()[0].getMethodName(),SQL);
        return SQL;
    }

    public String queryActualizaActa() {
        String SQL = 
            "update ac_acta" + " set   ind_carg_abon     = ?," + "       cod_usua_abon     = ?," + 
            "       fec_carg_abon     = to_date(?,'ddmmyyyyhh24miss')," + 
            "       ind_impr_abon     = ?," + 
            "       fec_impr_abon     = to_date(?,'ddmmyyyyhh24miss')" + 
            " where tip_docu_cmpb     = ?" + " and   cod_seri_cmpb     = ?" + 
            " and   num_cmpb          = ?" + " and   tip_docu_acta     = ?";
        CadenaUtil.logSQL(this.getClass(),new Exception().getStackTrace()[0].getMethodName(),SQL);
        return SQL;
    }

   /* NO Usar - JCR
    public String queryActualizaActaImpresion() {
        String SQL = 
            "update ac_acta" + " set   fec_impr_abon     = to_date(?,'ddmmyyyyhh24miss')" + 
            " where " + "       tip_docu_cmpb     = ?" + 
            " and   cod_seri_cmpb     = ?" + " and   num_cmpb          = ?" + 
            " and   ind_carg_abon     = ?" + " and   ind_impr_abon     = ?" +             
            " and   fec_carg_abon     >= to_date(?,'dd/mm/yyyy')" + 
            " and   fec_carg_abon     < to_date(?,'dd/mm/yyyy')" + 
            " and   tip_docu_acta     = ?";
        CadenaUtil.logSQL(this.getClass(),new Exception().getStackTrace()[0].getMethodName(),SQL);
        return SQL;
    }
    */

    public String queryActualizaCuentasClienteDetalle() {
        String SQL = 
            "Update ac_cntas_clie_deta" + "	set mon_cnta_cont    = ?," + 
            "   mon_anom = ?," + "   ind_csin_recu = ?" + 
            " Where cod_clie      = ?" + "	and cod_orig = ?" + 
            "	and cod_seri_cmpb = ?" + "	and tip_docu_cmpb = ?" + 
            "	and num_cmpb = ?" + "	and cod_cnta = ?" + 
            "	and nse_cod_orig = ?";CadenaUtil.logSQL(this.getClass(),new Exception().getStackTrace()[0].getMethodName(),SQL);
        return SQL;
    }
}
